home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Developer Helper 1: Phil & Dave's Excellent CD
/
Excellent CD HFS.raw
/
Moof
/
Goodies
/
HyperCard Goodies
/
HyperCard Dev. ToolKit
/
XCMD.Sources
/
resetPort.p
< prev
next >
Wrap
Text File
|
1987-08-17
|
2KB
|
79 lines
{$R-}
(*
resetSPort(port number, setting) -- Reset the serial port driver.
By Harry Chesley. DO NOT call the author! Contact Apple Developer
Support on AppleLink "MacDTS" or on MCI "MacTech".
©Apple Computer, Inc. 1987
All Rights Reserved.
To compile and link this file using Macintosh Programmer's Workshop,
pascal -w resetPort.p
link -m ENTRYPOINT -o HyperTerm -rt XCMD=1 -sn Main=resetSPort resetPort.p.o "{MPW}"Libraries:interface.o
*)
{$S resetSPort } { Segment name must be the same as the command name. }
unit DummyUnit;
interface
uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
procedure EntryPoint(paramPtr: XCmdPtr);
implementation
type
Str31 = String[31];
procedure resetSPort(paramPtr: XCmdPtr); forward;
procedure EntryPoint(paramPtr: XCmdPtr);
begin
resetSPort(paramPtr);
end;
procedure resetSPort(paramPtr: XCmdPtr);
var portNumber: integer;
setting: integer;
inPort, outPort: integer;
str: Str255;
{$I XCmdGlue.inc}
procedure Fail(errMsg: Str255); { set theResult and quit }
begin
paramPtr^.returnValue := PasToZero(errMsg);
exit(resetSPort);
end;
begin
if paramPtr^.paramCount <> 2 then Fail('parameter count is not 2');
ZeroToPas(paramPtr^.params[1]^,str); { First parameter is port number. }
portNumber := StrToNum(str);
if (portNumber < 1) or (portNumber > 2) then Fail('invalid port number');
ZeroToPas(paramPtr^.params[2]^,str); { Second parameter is setting. }
setting := StrToNum(str);
if portNumber = 1 then
begin
inPort := -6; outPort := -7;
end
else
begin
inPort := -8; outPort := -9;
end;
if (SerReset(inPort,setting) <> noErr) or (SerReset(outPort,setting) <> noErr) then
Fail('SerReset failed');
end;
end.